package com.smartleanx.module.hrm.service.esign.listener;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.smartleanx.module.bpm.event.BpmProcessInstanceStatusEvent;
import com.smartleanx.module.bpm.event.BpmProcessInstanceStatusEventListener;
import com.smartleanx.module.hrm.eums.employee.ProcessDefinitionEnum;
import com.smartleanx.module.hrm.service.esign.task.ESignTaskService;

import lombok.extern.slf4j.Slf4j;

/**
 * 员工外出流程状态监听器
 */
@Slf4j
@Component
public class BpmElecLaborListener extends BpmProcessInstanceStatusEventListener {

    @Resource
    private ESignTaskService eSignTaskService;

    @Override
    protected String getProcessDefinitionKey() {
        return ProcessDefinitionEnum.ELEC_LABOR.getKey();
    }

    @Override
    protected void onEvent(BpmProcessInstanceStatusEvent event) {
        eSignTaskService.createTaskSignFlowByBpmProcessId(event.getId(), event.getStatus(),event.getComments());
    }
}
